<html>

  <head>
    <title>XmlPlus Examples</title>
  </head>

  <h2>XmlPlus Examples</h2>
  <hr NOSHADE SIZE=10 WIDTH=100%>

  <body>
    <form>
      
      <ul>
        <li><a href="#HOWTO_EXAMPLES">How to try examples</a>
        <li><a href="#EX_BY_TAGS">Examples by tags</a>
        <li><a href="#ALL_EXAMPLES">All examples</a>
      </ul>

      <a name="HOWTO_EXAMPLES"><h3>How to try examples</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>
      
      Please read the topic <a href="usage.html">Tool Usage</a>, to learn about xsd2cpp-usage, building generated source, and running the executables.<br><br> 

      Each example directory, comes with following files:
      <ol>
        <li> one or more XML-Schema file(s)
        <li> a valid.xml file(a valid XML file for reference)
        <li> a main.cpp file ( with populateDocument template function populated)
      </ol>
      
      As mentioned earlier, xsd2cpp usage is:<br>
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>
      <code>
        $ xsd2cpp <br> 
        Usage:<br>
        1.  xsd2cpp xsd-file [outdir]<br>
        &nbsp;&nbsp;&nbsp;&nbsp;outdir: directory to output the generated source, like foo, . , .. etc.<br>
        &nbsp;&nbsp;&nbsp;&nbsp;(if unspecified, defaults to xsd-file-name)<br>
        <br>
        2.  xsd2cpp -v<br>
        &nbsp;&nbsp;&nbsp;&nbsp;prints version<br>
        <br>
        3.  xsd2cpp -h<br>
        &nbsp;&nbsp;&nbsp;&nbsp;prints help<br>
      </code>
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>
      <br><br>

      <b>To try examples, all you have to do is to, run xsd2cpp in the respective examples directory with output directory 
      specified as "." and then build.</b><br>
      Each example directory is already provided with the main.cpp having populateDocument() function already filled.
      <br><br>

      You can of course, experiment with the code in the main.cpp, especiallly with the template functions:<br> 
      <code>  
      void populateDocument(DOM::Document* pDoc)<br>
      void updateOrConsumeDocument(DOM::Document* pDoc)<br>
      </code>
  
      Note that, for writing sample XML document, roundtripping XML document, or validating XML document you don't have to fill the above mentioned functions in main.cpp file. 

      <br><br>
      It is recommended that you use outdir as ".", for examples because:
      <ul>  
        <li> example directories are already organized with sensible names
        <li> using outdir as "." helps in easily consuming supplied main.cpp in build
      </ul>  

      If for whatever reason you have specified a outdir other than ".", then you would need to:
      <ul>
        <li> copy the supplied main.cpp in the outdir
        <li> cd outdir , before building the source
      </ul>  

      Here is an example xsd2cpp run of simpleTypesDemo example:<br>
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>
        <code>
        $ cd simpleTypesDemo/<br>
        $ xsd2cpp simpleTypesDemo.xsd .<br>
        output path: .<br>
        =&gt;  Generating source files...<br>
        =&gt;  Generating automake/autoconf files ...<br>
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>

      <br><br>
      For building the source in the outdir:
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>
      $ ./autogen.sh<br>
      $ make 	<br>
      $ make install 	<br>
      $ make doxygen-doc<br>
        </code>
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>

      <br><br>
      After successful build and install, you should have a run binary installed. Use this run binary to try out the available options.  <br>
      An example of &lt;name&gt;run options: 
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>
        <code>
      $ ./build/bin/simpleTypesDemorun --help <br>
      Usage: ./build/bin/simpleTypesDemorun [options] [XMLfile] <br>
      Options:<br>
      &nbsp;-s, --sample<br>
      &nbsp;&nbsp; create a schema-driven sample xml-file<br>
      &nbsp;&nbsp; Note: optional fields are omitted<br>
      &nbsp;-w, --write<br>
      &nbsp;&nbsp; write a xml-file using populated Document<br>
      &nbsp;&nbsp; Note: populateDocument() function in main.cpp template,<br>
      &nbsp;&nbsp; must be used to populate the Document<br>
      &nbsp;-v, --validate<br>
      &nbsp;&nbsp; validate input xml-file(against compiled schema)<br>
      &nbsp;-r, --roundtrip<br>
      &nbsp;&nbsp; roundtrip (read-&gt;write) input xml-file<br>
      &nbsp;-u, --row<br>
      &nbsp;&nbsp; perform read-&gt;operate-&gt;write operations on input xml-file<br>
      &nbsp;-h, --help<br>
      &nbsp;&nbsp; print help<br>
        </code>         
      <hr NOSHADE SIZE=1 WIDTH=50% align=left>




      <br><br>
      <a name="EX_BY_TAGS"><h3>Examples by tags</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>
      
      <table border=1>
        <caption>Find examples by tags</caption>

        <tr>
          <th width=20%>Example</th>
          <th width=80%>Associated Tags</th>
        </tr>
        <tr>
          <td><a href="#HELLO_WORLD">helloWorld</a></td>
          <td>
          <b>Schema components:</b> element
          <br><b>BuiltIn Types:</b> string
          </td>
        </tr>
        <tr>
          <td><a href="#HELLO_WORLDWIDE">helloWorldWide</a></td>
          <td>
          <b>Schema components:</b> element
          <br><b>BuiltIn Types:</b> string
          <br><b>Facets:</b> maxLength
          <br><b>Other Tags:</b> wide characters
          </td>
        </tr>
        <tr>
          <td><a href="#SIMPLEST">simplest</a></td>
          <td>
          <b>Schema components:</b>
            complexType, element, attribute
          <br><b>BuiltIn Types:</b> string
          <br><b>Schema controlled Attributes:</b>
            elementFormDefault
          <br><b>Other Tags:</b>
            targetNamespace, mixed content
          </td>
        <tr>
        <tr>
          <td><a href="#SIMPLETYPES_DEMO">simpleTypesDemo</a></td>
          <td>
          <b>Schema components:</b>
            complexType, simpleType, element, attribute
          
          <br><b>Schema controlled Attributes:</b>
            elementFormDefault, attributeFormDefault, minOccurs, maxOccurs, fixed

          <br><b>simpleType variety:</b> atomic, union, list

          <br><b>BuiltIn Types:</b>
          boolean, decimal, float, double, integer, positiveInteger, 
          nonPositiveInteger, negativeInteger, nonNegativeInteger, long, 
          int, short, byte, unsignedLong, unsignedInt, unsignedShort, 
          unsignedByte, hexBinary, base64Binary, anyURI, normalizedString, 
          token, language, Name, NCName, QName, dateTime, date, 
          gYearMonth, gYear, gMonthDay, gMonth, gDay, time, duration, 
          ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS
          
          <br><b>Facets:</b>
            minLength, minInclusive, maxInclusive, minExclusive, maxExclusive, pattern etc.
          
          <br><b>Other Tags:</b>
            targetNamespace, mixed content, attribute/element sharing common name
          </td>


        </tr>
        <tr>
          <td><a href="#PO">purchaseOrder</a></td>
          <td>
          <b>Schema components:</b>
            complexType, simpleType, element, attribute, anonymous element
          
          <br><b>Schema controlled Attributes:</b>
            minOccurs, maxOccurs, fixed

          <br><b>Facets:</b>
            pattern
          </td>
        <tr>
        <tr>
          <td><a href="#MAILS">mails</a></td>
          <td>
          <b>Schema components:</b>
            complexType, simpleType, element, attribute
          
          <br><b>Schema controlled Attributes:</b>
            minOccurs, maxOccurs

          <br><b>Facets:</b>
            enumeration
          
          <br><b>Other Tags:</b>
            Model Group 'sequence' with maxOccurs="unbounded"
          </td>
        <tr>
        <tr>
          <td><a href="#INCDEMO">includeDemo</a></td>
          <td>
          <b>Schema components:</b>
            complexType, simpleType, element, attribute, include

          <br><b>Schema controlled Attributes:</b>
            minOccurs, maxOccurs
          </td>
        <tr>
        <tr>
          <td><a href="#ORG">organization</a></td>
          <td>
           <b>Schema components:</b>
            complexType, simpleType, element, attribute, import
          
            <br><b>Schema controlled Attributes:</b>
            minOccurs, maxOccurs
            
            <br><b>Other Tags:</b>
            targetNamespace, nested imports
          </td>
        <tr>
      </table>

      <a name="ALL_EXAMPLES"><h3>All Examples</h3></a>
      <hr NOSHADE SIZE=7 WIDTH=100%>

      All the examples follow, without any specific order.   


      <a name="HELLO_WORLD"><h4>helloWorld</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/helloWorld/helloWorld.xsd">helloWorld.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/helloWorld/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/helloWorld/main.cpp">main.cpp</a>
      <br><br>
      <br><br>
      
      <a name="HELLO_WORLDWIDE"><h4>helloWorldWide</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/helloWorldWide/helloWorldWide.xsd">helloWorldWide.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/helloWorldWide/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/helloWorldWide/main.cpp">main.cpp</a>
      <br><br>
      <br><br>
      
      <a name="SIMPLEST"><h4>simplest</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/simplest/simplest.xsd">simplest.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/simplest/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/simplest/main.cpp">main.cpp</a>
      <br><br>
      <br><br>


      <a name="SIMPLETYPES_DEMO"><h4>simpleTypesDemo</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/simpleTypesDemo/simpleTypesDemo.xsd">simpleTypesDemo.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/simpleTypesDemo/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/simpleTypesDemo/main.cpp">main.cpp</a>
      <br><br>
      <br><br>

      <a name="PO"><h4>purchaseOrder</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/po/po.xsd">po.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/po/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/po/main.cpp">main.cpp</a>
      <br><br>
      <br><br>

      <a name="MAILS"><h4>mails</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/mails/mails.xsd">mails.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/mails/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/mails/main.cpp">main.cpp</a>
      <br><br>
      <br><br>

      <a name="INCDEMO"><h4>includeDemo</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd file: <a href="../../examples/includeDemo/includeDemo.xsd">includeDemo.xsd</a>
      <br><br>
      The valid.xml file: <a href="../../examples/includeDemo/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/includeDemo/main.cpp">main.cpp</a>
      <br><br>
      <br><br>

      <a name="ORG"><h4>organization</h4></a>
      <hr NOSHADE SIZE=3 WIDTH=100%>
      The xsd files:
        <ul>  
          <li><a href="../../examples/org/org.xsd">org.xsd</a>
          <li><a href="../../examples/org/engg.xsd">engg.xsd</a>
          <li><a href="../../examples/org/legal.xsd">legal.xsd</a>
          <li><a href="../../examples/org/hr.xsd">hr.xsd</a>
        </ul>  
      The valid.xml file: <a href="../../examples/org/valid.xml">valid.xml</a>
      <br><br>
      The main.cpp file: <a href="../../examples/org/main.cpp">main.cpp</a>
      <br><br>
      <br><br>

    </form>
  </body>


</html>
